import {
	post,
	get,
	put
} from '@/utils/request.js'

/**
 * wxCode校验
 */
export const authCodeApi = (code) => {
	return post(`/auth/code?code=${code}`)
}

/**
 * 获取并解密wx手机号
 */
export const getWxMobileApi = (data) => {
	return post('/auth/getWxMobile', data)
}

/**
 * 手机号登录注册
 */
export const loginApi = (data) => {
	return post('/auth/login', data)
}

/**
 * 手机号密码登录
 */
export const phoneLoginApi = (data) => {
	return post('/auth/loginByMobile', data)
}

/**
 * 手机号获取验证码
 */
export const sendSms = (data) => {
	return post('/sms/send', data)
}

export const updatePwd = (data) => {
	return put('/user/updatePwd',data)
}

/**
 * 获取用户/商家详细信息
 */
export const userInfoApi = () => {
	return get('/user/getUserInfo')
}

/**
 * 分享海报是否显示商家头像开关
 */
export const updatePosterShowAvatarStateApi = (data) => {
	return post('/business/updatePosterShowAvatarState', data)
}

// 我的页面数据
export const getMyPage = () => {
	return get('/index/myPage')
}

/**
 * 退出登录
 */
export const logoutApi = () => {
	return post('/auth/logout')
}
// 关注公众号

export const getSubscribeState = (id) => {
	return get(`/user/getSubscribeState`)
}

